Skip to content

feat(checkpoint): support the --lazy-pages option - #3945

Open
donkomura wants to merge 1 commit into
youki-dev:mainfrom
donkomura:feat/checkpoint-lazy-pages
Open

donkomura wants to merge 1 commit into
youki-dev:mainfrom
donkomura:feat/checkpoint-lazy-pages

Conversation

@donkomura

Copy link
Copy Markdown
Contributor

Description

Pass --lazy-pages to CRIU so that the dump leaves the memory pages out of the image and serves them on demand from a page server.

The contest test checks that CRIU starts listening on the page server port and that the container keeps running with --leave-running. As in runc's integration test, it is skipped when CRIU lacks uffd-noncoop.

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Refactoring (no functional changes)
  • Performance improvement
  • Test updates
  • CI/CD related changes
  • Other (please describe):

Testing

  • Added new unit tests
  • Added new integration tests
  • Ran existing test suite
  • Tested manually (please provide steps)

Related Issues

#3394

Additional Context

Difference from runc

Before a lazy-pages dump, runc sends a FEATURE_CHECK request to CRIU. If CRIU does not support lazy pages, runc fails early with criu is missing features: [LazyPages]. youki does not make this check, because rust-criu has no public API to send a FEATURE_CHECK request. With an unsupported CRIU, youki does not reject the request beforehand, and the checkpoint fails during the dump with CRIU's own error.

The feature check will be added outside this PR. The plan is to add the API to rust-criu first and, after a rust-criu release includes it, call it from youki when --lazy-pages is given.

Pass --lazy-pages to CRIU so that the dump leaves the memory pages out
of the image and serves them on demand from a page server.

The contest test checks that CRIU starts listening on the page server
port and that the container keeps running with --leave-running. As in
runc's integration test, it is skipped when CRIU lacks uffd-noncoop.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: donkomura <koiru3822fs@gmail.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The readiness-timeout fallback can kill only the runtime while leaving CRIU blocked in accept(), leaking the page server, so forced cleanup must terminate CRIU too.

1 open issue
What changed in this PR

Adds --lazy-pages checkpoint support, wiring the CLI option through to CRIU so memory pages can be served on demand rather than stored in checkpoint images.

Changes:

  • Passes the lazy-pages flag through the CLI, checkpoint options, and CRIU configuration.
  • Adds an integration test for page-server readiness and --leave-running, skipped when CRIU lacks uffd-noncoop.
  • Extracts shared timeout-waiting and unused-port helpers.
File Description
tests/​contest/​contest/​src/​tests/​lifecycle/​container_lifecycle.rs Registers the lazy-pages test and feature checks.
tests/​contest/​contest/​src/​tests/​lifecycle/​checkpoint.rs Adds lazy-pages testing and shared process helpers.
crates/​youki/​src/​commands/​checkpoint.rs Forwards the CLI flag into checkpoint options.
crates/​liboci-cli/​src/​checkpoint.rs Exposes --lazy-pages.
crates/​libcontainer/​src/​container/​container.rs Adds the lazy-pages checkpoint option.
crates/​libcontainer/​src/​container/​container_checkpoint.rs Configures CRIU with the lazy-pages setting.

Review effort: Balanced

Comment on lines +893 to +894
let _ = self.child.kill();
let _ = self.child.wait();

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants